<?php

/**
 * 首页
 */
class IndexAction extends HomeAction {

    public function index() {
        $list = D('Gezi')->show(40);
        $data = array();
        $data['geziCount']    = M('Gezi')->count();
        $data['serviceCount'] = M('Service')->count();
        $data['catadCount']   = M('Catad')->count();
        $data['dazheCount']   = M('Dazhe')->count();
        $this->seo('首页 ');
        $this->assign('count', $data);
        $this->assign($list);
        $this->display();
    }

    /**
     * 瀑布流ajax调用 
     */
    public function ajax() {
        $list   = D('Gezi')->show(8);
        $reData = array();
        foreach ($list['list'] as $lv) {
            $reData[] = array(
                's_img' => $lv['s_img'],
                'b_img' => $lv['b_img'] ? $lv['b_img'] : $lv['s_img'],
                'url' => ($lv['article_id'] != 0) ? U('Home/Page/show', array('pid' => $lv['article_id'])) : (($lv['link_id'] == 0) ? '#' : U('Home/Link/jump', array('id' => $lv['link_id']))),
            );
        }
        $this->ajaxReturn($reData);
    }
    
    
    public function test(){
        dump(C('SITEURL'));
    }

}
